#include<string>
#include<unordered_map>
using namespace std;
int lengthOfLongestSubstring(string s) {
    int n = s.size(), len = 0;
    unordered_map<char, int> hash;
    for (int left = 0, right = 0; right < n; right++)
    {
        while (hash.find(s[right]) != hash.end())
        {
            len = max(len, right - left);
            hash.erase(s[left]);
            left++;
        }
        len = max(len, right - left + 1);
        hash[s[right]]++;
    }

    return len == 0 ? s.size() : len;
}

int main()
{
    lengthOfLongestSubstring(" ");
	return 0;
}